package com.itheima;

import java.util.concurrent.*;

/**
 * 2025/5/13 15:44
 */
public class ThreadDemo {

    private static ThreadLocal<Long> threadLocal = new ThreadLocal<>();

    public static void main(String[] args) {

        threadLocal.set(1L);
        System.out.println(Thread.currentThread().getName());

        new Thread(new Runnable() {
            @Override
            public void run() {

                System.out.println(Thread.currentThread().getName());
                test();
            }
        }).start();
    }

    public static void test() {

        Long l = threadLocal.get();
        System.out.println("从当前线程中获取到的数据是：" + l);

    }




}
